//资讯管理
import request from "@/api/request.js";

export const getAllNewsService = categroyid => {
  return request.get(`/api-self/admin_panel/categroy/${categroyid}/news`);
};

export const addNewsService = DataObj => {
  let url = `/api-self/admin_panel/categroy/${DataObj.categroyID}/new`;
  let Data = {
    newsTitle: DataObj.newsTitle,
    newsContent: DataObj.newsContent
  };
  return request.post(url, Data);
};

export const delNewsService = DataObj => {
  let url = `/api-self/admin_panel/categroy/${DataObj.categroyID}/new/${DataObj.newsID}`;
  return request.delete(url);
};

export const editNewsService = DataObj => {
  let url = `/api-self/admin_panel/categroy/${DataObj.categroyID}/new${DataObj.newsID}`;
  let Data = {
    newsTitle: DataObj.newsTitle,
    newsContent: DataObj.newsContent
  };
  return request.put(url, Data);
};
